import homeRoute from './modules/home';
import partRoute from './modules/part';
import demoRoute from './modules/demo';
import documentRoute from './modules/document';
import cadDocumentRoute from './modules/cadDocument';
import projectListRoute from './modules/projectList';
import productLibraryRoute from './modules/productLibrary';

/** 路由表 */
const routes = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login.vue'),
    meta: { title: '登录', keepAlive: false },
  },
  {
    path: '/:pathMatch(.*)*',
    name: '404',
    component: () => import('@/views/404.vue'),
  },
  //Layout容器内的路由。layout外有children的路由若想在菜单上展示，该路由不能携带component
  //若需要某个路由具备缓存功能，需要keepAlive为true，并且路由对应的页面的name与路由的name要保持一致
  {
    path: '/',
    name: 'Layout',
    redirect: '/home',
    component: () => import('@/layout/index.vue'), // 路由懒加载
    children: [
      ...homeRoute,
      ...productLibraryRoute,
      ...partRoute,
      ...documentRoute,
      ...cadDocumentRoute,
      ...projectListRoute,
      ...demoRoute,
    ],
  },
  //Layout容器外的路由
  // {
  //   path: '/404',
  //   name: '404',
  //   component: () => import('@/views/404.vue'),
  //   meta: { title: '404', keepAlive: false },
  // },
];

export default routes;
